<?php
class System_model extends CI_Model{
	
	function __construct(){
		parent::__construct();
	}
	
###################################################################################################
	/*this function get the parameters form  storing foot prints from "system" controller
	 * and retruns false on faliure*/
	function insert_footprint($userid,$accessid,$act_description){
		
		
		//"$accessid" null means we have a login activity, else it is a in-system activity
		if($accessid == NULL){
			//store login activity
			$query = "INSERT INTO userfootprints_access (user_id) VALUES(?)";
			$parameters = array($userid);
			
			
			if($this->db->query($query, $parameters)){
				return mysql_insert_id();
			}
			
			else{
				return false;
			}
		}
		
		else{
			//store in-system activity
			$query = "INSERT INTO userfootprints_activities (access_id, activity_description) VALUES(?,?)";
			$parameters = array($act_description, $accessid);
			
			if($this->db->query($query, $parameters)){
				return true;
			}
			
			else{
				return false;
			}
		}
	
	}

#######################################################################################################################################
	
}